<?php
namespace app\admin\controller;

use app\admin\service\WxMiniPublishService;

class WxMiniPublishController extends CommonController
{
    // 检查更新
    public function checkUpdate(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(WxMiniPublishService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->checkUpdate();
        return $this->return_result($this->returnData);
    }

    // 预览码
    public function previewByMini(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(WxMiniPublishService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->previewByMini();
        return $this->return_result($this->returnData);
    }

    // 发布
    public function publishByMini(){
        if($this->returnData["code"] !== 0){
            return $this->return_result($this->returnData);
        }
        $service = $this->app->invokeClass(WxMiniPublishService::class, [$this->returnData, $this->params]);
        $this->returnData = $service->publishByMini();
        return $this->return_result($this->returnData);
    }
}